<script src="__ADMINMY__/upimg.js"></script>
<link rel="stylesheet" href="__ADMINMY__/my.css">

<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            广告图
            <small>it all starts here</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="{:url('/admin/index/index')}"><i class="fa fa-dashboard"></i> 控制台</a></li>
            <li><a href="#">广告图</a></li>
        </ol>
    </section>


    <!-- Main content -->
    <section class="content">

        <div class="row">
            <div class="col-xs-12">
                <div class="box">
                    <div class="box-header">
                        <h3 class="box-title">Advertising  Table</h3>

                        <div class="box-tools">
                            <!--<a href="{:url('admin/banner/add')}" class="btn btn-info pull-right">添加文章</a>-->
                            <button type="button" class="btn btn-info pull-right" data-toggle="modal" data-target="#myModal">
                                添加图片
                            </button>
                        </div>
                    </div>
                    <!-- /.box-header -->
                    <div class="box-body table-responsive no-padding">
                        <form action="{:url('admin/banner/delall')}" method="post">
                            <table class="table table-hover text-center"  >
                                <tbody><tr>
                                    <th class="text-center" width="100"><input type="checkbox" value="" id="checkall" class=""> 全选</th>
                                    <th >ID</th>
                                    <th style="width: 50%;">图片</th>

                                    <th style="width: 20%">操作</th>
                                </tr>

                                <?php foreach($banner as $v): ?>
                                <tr>
                                    <td class="text-center"><input type="checkbox" value="<?php echo $v['b_id']; ?>" name="idarr[]" class="cbox"></td>
                                    <td><?php echo $v['b_id'] ?></td>
                                    <td> <img src="<?php echo thumb($v['b_img'], 500, 200); ?>" alt="">
                                    </td>

                                    <td>
                                        <!--<button type="button" class="btn btn-sm  glyphicon glyphicon-trash btn-primary " data-toggle="modal" data-target="#myModal">-->
                                        <!--修改-->
                                        <!--</button>-->
                                        <a href="{:url('admin/banner/edit',['id' => $v['b_id'] ])}"><button type="button" class="btn btn-sm btn-primary glyphicon glyphicon-pencil">  修改</button></a>
                                        <a href="{:url('admin/banner/del',['id' => $v['b_id'] ])}"><button id="delbtn" type="button" class="btn btn-sm btn-danger glyphicon glyphicon-trash">  删除</button></a>
                                    </td>
                                </tr>
                                <?php endforeach; ?>
                                </tbody>
                            </table>
                            <div id="content"></div>

                            <div class="pull-left" style="margin: 20px;">
                                <button type="submit" class="btn btn-default btn-gradient pull-right delall"><span class="glyphicon glyphicon-trash"></span></button>
                            </div>
                        </form>
                    </div>
                    <!-- /.box-body -->
                </div>
                <!-- /.box -->
            </div>
        </div>


    </section>
    <!-- /.content -->




</div>

<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">添加广告图</h4>
            </div>
            <form method="post" action="{:url('admin/banner/add')}" id="myform" enctype="multipart/form-data">
                <div class="modal-body">

                    <div class="row text-center">
                        <div class="col-lg-12" id="preview">
                            <img id="imghead" border="0" src="__ADMINMY__/photo_icon.png" width="150" height="150" onclick="$('#previewImg').click();">
                            <label for="" style="margin-right: 20px;">上传图片</label>
                        </div>
                        <input type="file" name="image" onchange="previewImage(this,500,250)" style="display: none;" id="previewImg">
                    </div>


                </div>
                <div class="modal-footer">
                    <button type="submit" class="btn  btn-info"  >保存</button>
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <!--<button type="button" class="btn btn-primary">Save changes</button>-->
                </div>
            </form>
        </div>
    </div>
</div>
